home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Applications / ircle 1.5.1 / source / ircle sources / IRCGlobals.p < prev    next >
Encoding:
Text File  |  1993-11-15  |  5.2 KB  |  188 lines  |  [TEXT/PJMM]

  1. {    ircle - Internet Relay Chat client    }
  2. {    File: IRCGlobals    }
  3. {    Copyright © 1992 Olaf Titz (s_titz@ira.uka.de)    }
  4.  
  5. {    This program is free software; you can redistribute it and/or modify    }
  6. {    it under the terms of the GNU General Public License as published by    }
  7. {    the Free Software Foundation; either version 2 of the License, or    }
  8. {    (at your option) any later version.    }
  9.  
  10. {    This program is distributed in the hope that it will be useful,    }
  11. {    but WITHOUT ANY WARRANTY; without even the implied warranty of    }
  12. {    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    }
  13. {    GNU General Public License for more details.    }
  14.  
  15. {    You should have received a copy of the GNU General Public License    }
  16. {    along with this program; if not, write to the Free Software    }
  17. {    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.    }
  18.  
  19. unit IRCGlobals;
  20. { Contains global constants and variables }
  21.  
  22. interface
  23. uses
  24.     TCPTypes, TCPStuff, TCPConnections, MiscGlue, MsgWindows;
  25.  
  26. type
  27.     defaultType = record
  28.             Port: integer;
  29.             Server, Nick, username, userLoginName, autoExec: str255;
  30.             notify: array[1..4] of boolean;
  31.         end;
  32.     defaultPtr = ^defaultType;
  33.     defaultHndl = ^defaultPtr;        { Preferences }
  34.  
  35.     shortcutsType = array[1..10] of str255;
  36.     shortcutsPtr = ^shortcutsType;
  37.     shortcutsHndl = ^shortcutsPtr;    { Shortcuts }
  38.  
  39.     FSType = record
  40.             fnt, siz: integer
  41.         end;
  42.     FSPtr = ^FSType;
  43.     FSHndl = ^FSPtr;                { default font/size }
  44.  
  45.     Table = packed array[char] of char;
  46.     TablePtr = ^Table;
  47.     TableHndl = ^TablePtr;        { charset translation table }
  48.  
  49.     str20 = string[20];
  50.     CEPtr = ^ConnectionEventRecord;
  51.  
  52.  
  53. const
  54.  
  55.     CREATOR_IRCLE = 'præC';
  56.     TYPE_PREFS = 'Pref';
  57.  
  58.     COSPACE = 10000;        { Workspace to allocate for Coroutines }
  59.     LOFREEMEM = 20000;        { Memory checking lower (critical) bound }
  60.     HIFREEMEM = 30000;        { Memory checking higher (uncritical) bound }
  61.     MEMTIME = 30;            { Memory checking timeout (seconds) }
  62.  
  63.     DCC_CHAT_PREFIX = '=';
  64.     DCC_CHAT_POSTFIX = '=';
  65.     INACTIVE_PREFIX = '(';
  66.     INACTIVE_POSTFIX = ')';
  67.  
  68. { Error messages (STR#256 indexes) }
  69.     E_NOSERVER = 1;        { Not connected }
  70.     E_NOTARGET = 2;        { Not talking to a target }
  71.     E_SFAILED = 3;            { Corresponding with ConnectionEvents }
  72.     E_NSFAILED = 4;
  73.     E_OFAILED = 5;
  74.     E_CLOSING = 6;
  75.     E_CLOSED = 7;
  76.     E_OPEN = 8;            { Attempting to re-open }
  77.     E_NOPREFS = 9;            { Don't have valid prefs }
  78.     E_NOHELP = 10;            { This means the app file is broken... }
  79.  
  80. { Connection status }
  81.     S_CONN = 0;            { connected }
  82.     S_OFFLINE = 1;            { offline }
  83.     S_LOOKUP = 2;            { DNS lookup }
  84.     S_OPENING = 3;            { connecting }
  85.     S_CLOSING = 4;            { closing }
  86. { Server versions }
  87.     SV_27 = 27;
  88.     SV_28 = 28;
  89.  
  90. { Alerts }
  91.     A_INFO = 128;            { About box }
  92.     A_TCPERR = 129;        { Cannot open TCP driver }
  93.     A_QUIT = 131;            { Ask whether to quit }
  94.     A_SAVE = 132;            { Ask whether to save set }
  95.     A_CONVERT = 133;        { Warning about oldstyle prefs file }
  96.     A_LOWMEM = 259;        { Memory shortage }
  97.     A_OPKILL = 260;        { Operator kill }
  98.     A_SSTAT = 261;        { Server connection status }
  99.     A_FERR = 262;            { File system error }
  100.  
  101. { Dialogs }
  102.     D_INFOPOP = 130;        { Popup status window }
  103.     D_PREFS = 256;            { Preferences }
  104.     D_SHCUTS = 257;        { Shortcuts }
  105.  
  106. { Menus }
  107.     M_F_OPEN = 1;
  108.     M_F_CLOSE = 2;
  109.     M_F_LOAD = 4;
  110.     M_F_SAVE = 5;
  111.     M_F_PREFS = 6;
  112.     M_F_LOG = 8;
  113.     M_F_FLUSH = 9;
  114.     M_F_QUIT = 11;
  115.     M_COMMANDS = 259;        { Commands menu }
  116.     M_CO_JOIN = 1;
  117.     M_CO_PART = 2;
  118.     M_CO_LIST = 4;
  119.     M_CO_WHO = 5;
  120.     M_CO_QUERY = 7;
  121.     M_CO_WHOIS = 8;
  122.     M_CO_INVITE = 9;
  123.     M_CO_KICK = 10;
  124.     M_CO_AWAY = 12;
  125.     M_CO_MSG = 13;
  126.     M_SHCUTS = 261;        { Shortcuts menu }
  127.     M_SH_DEFINE = 1;
  128.     M_SH_FIRST = 2;
  129.     M_FONT = 262;            { Fonts menu }
  130.     M_FO_9 = 1;
  131.     M_FO_10 = 2;
  132.     M_FO_12 = 3;
  133.     M_FO_14 = 4;
  134.     M_FO_FIRST = 5;
  135.     M_WINDOWS = 263;        { Windows menu }
  136.     M_WI_CYCLE = 1;
  137.     M_WI_MAIN = 2;
  138.     M_WI_FIRST = 3;
  139.  
  140.  
  141. var
  142. { general status vars }
  143.     CL_VERSION: string;        { Version of this program }
  144.     serverVersion,             { Version of server }
  145.     serverStatus: integer;    { Connection status }
  146.     dirtyPrefs,                { Need to save prefs }
  147.     readPrefs,                { Need to read prefs from file }
  148.     UserRegistered,             { USER command already done }
  149.     QuitRequest,            { Will quit }
  150.     flushing,                 { Ignore server output up to end of list }
  151.     logging,                { Logging to file }
  152.     IsAway,                { AWAY status set }
  153.     inBackground,            { Running in background }
  154.     notified                { User has got notfication from background }
  155.     : boolean;
  156.     sSocket: connectionIndex;    { Server connection }
  157.     lastWindow: MWHndl;        { window last notice went in }
  158.     readTimeout,            { timeout for TCP reading }
  159.     idleTime: longint;        { time when last command sent }
  160.     NFT: integer;            { number of DCC filetransfers in progress }
  161.  
  162. { user vars }
  163.     CmdChar: char;            { Command prefix }
  164.     CurrentServer,             { server currently connected to }
  165.     CurrentTarget,            { current target to talk to (corresponds to active window) }
  166.     lastInvite                { Channel to which got last invited }
  167.     : str255;
  168.     CurrentNick,             { Nickname }
  169.     lastMsg                { Nick who sent last MSG }
  170.     : str20;
  171.     initFile,                 { File to read init commands from }
  172.     logfile: text;            { File to log to }
  173.  
  174. { user display status }
  175.     showJOIN, showPART, showQUIT, showWALLOPS, showTOPIC, {}
  176.     showINVITE, showNICK, showMODE, showKICK, showNAMES: boolean;
  177.  
  178. { user preferences }
  179.     default: defaultHndl;
  180.     Shortcuts: shortcutsHndl;
  181.     defFont: FSHndl;
  182.  
  183.     ISOEncode, ISODecode: TableHndl;
  184.  
  185.  
  186. implementation
  187. { Global variables get initialized in IRCInit }
  188. end.